package com.power.project.model.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.power.project.enums.CustomNodeTypeEnum;
import com.power.project.interfaces.CustomNode;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * @Author mrzhao
 * @CreateDate 2024/6/28 10:38
 * @Desc 人员部门关系
 * @Version 1.0
 */
@Data
public class UserDepartDTO implements CustomNode {
    /**
     * 是否为该部门负责人0:否 1：是
     */
    private Integer isLeader;
    /**
     * 部门 ww_depart.departid
     */
    @NotNull
    @NotEmpty
    private String departId;
    /**
     * 部门名称
     */
    private String name;
    /**
     * 用户id
     */
    @JsonIgnore
    private String userId;
    /**
     * 用户名称
     */
    @JsonIgnore
    private String userName;

    @Override
    @JsonIgnore
    public String getNodeId() {
        return this.userId;
    }

    @Override
    @JsonIgnore
    public String getParentNodeId() {
        return this.departId + "";
    }

    @Override
    @JsonIgnore
    public String getNodeName() {
        return this.userName;
    }

    @Override
    @JsonIgnore
    public Integer getNodeWeight() {
        return -1;
    }

    @Override
    @JsonIgnore
    public CustomNodeTypeEnum getType() {
        return CustomNodeTypeEnum.USER;
    }
}
